package com.tao.config;

import com.tao.properties.JWTProperties;
import com.tao.utils.ALiOSSUtil;
import com.tao.utils.JWTUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class JWTUtilConfiguration {
    @Autowired
    JWTProperties jwtProperties;

    @Bean
    @ConditionalOnBean
    public JWTUtil jwtUtil(){
        log.info("开始注册JWT工具类");
        return new JWTUtil(jwtProperties.secretKey,jwtProperties.getTtl(),jwtProperties.getTokenName());
    }
}
